﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.ServiceModel.Channels;
using OnlineGameLibrary.ClientChannel;

namespace OnlineGameLibrary.Activities
{

    public sealed class ClientChannelSend : CodeActivity<bool>
    {
        [RequiredArgument]
        public InArgument<Message> Message { get; set; }

        [RequiredArgument]
        public InArgument<IMyClientChannel> ClientChannel { set; get; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override bool Execute(CodeActivityContext context)
        {
            var channel = ClientChannel.Get(context);
            var msg = Message.Get(context);

            return channel.SendMessageToPlayer(msg);
        }
    }
}
